<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<shiro:hasPermission name="account:select">
	<div class="content1">
		<div class="header">
			<h1 class="page-title">用户开户列表</h1>
			<ul class="breadcrumb">
				<li>用户管理</li>
				<li class="active">用户开户列表</li>
			</ul>
		</div>
		<div class="main-content">
			<div class="row">
				<div class="col-md-2">
					<div class="form-group">
						<div class="input-group">
							<div class="input-group-addon">手机号</div>
							<input class="form-control" type="text" id="phoneNum">
						</div>
					</div>
				</div>
				<div class="col-md-2">
					<div class="form-group">
						<div class="input-group">
							<div class="input-group-addon">身份证号</div>
							<input class="form-control" type="text" id="idCardNo">
						</div>
					</div>
				</div>
				<div class="col-md-2">
					<div class="form-group">
						<div class="input-group">
							<div class="input-group-addon">状态</div>
							<select class="form-control" id="state">
								<option value="">--请选择--</option>
								<option value="1">正常</option>
								<option value="2">锁定</option>
								<option value="3">冻结</option>
								<option value="4">审核中</option>
								<option value="5">通过</option>
								<option value="6">审核不通过</option>
								<option value="7">删除</option>
							</select>
						</div>
					</div>
				</div>
				<div class="col-md-2">
					<button type="button" class="btn btn-primary btn-small btn-block"
						id="query">
						<i class="glyphicon glyphicon-search"></i> 查询
					</button>
				</div>
			</div>
			<table id="example" class="table"></table>
		</div>
		<script>
			//表格的初始化
			$(document).ready(function() {
				var table = $('#example').initTable({
					sAjaxSource:"account/initTable.htm",
					aoColumns: [
			            {
			            	"data":"customerName",
			            	"sTitle":"客户姓名",
			            	'sClass':"text-center"
			            },
			            { 
			              "data": "phoneNum",
			              "sTitle":"手机号",
			              'sClass':"text-center"
			            },
			            { 
				              "data": "idCardNo",
				              "sTitle":"身份证号码",
				              'sClass':"text-center"
				         },
			            { 
				              "data": "state",
				              "sTitle":"状态", 
				              'sClass':"text-center",
				              "mRender": function(data, type, full) { 
				                	if(data == 1){
										return "<font color='red'>正常</font>";
									}else if(data == 2){
										return "<font color='red'>锁定</font>";
									}else if(data == 3){
										return "<font color='red'>冻结</font>";
									}else if(data == 4){
										return "<font color='red'>审核中</font>";
									}else if(data == 5){
										return "<font color='red'>通过</font>";
									}else if(data == 6){
										return "<font color='red'>审核不通过</font>";
									}else if(data == 7){
										return "<font color='red'>删除</font>";
									}
				                } 
				          },
			            { 
				              "data": "hasModify",
				              "sTitle":"是否已修改(审核不通过时)",
				              'sClass':"text-center",
				              "mRender": function(data, type, full) { 
				                	if(data == 1){
										return "<font color='red'>是</font>";
									}else if(data == 2){
										return "<font color='red'>否</font>";
									}
				              } 
				        },
			            { 
				              "data": "modifyTime",
				              "sTitle":"修改时间",
				              'sClass':"text-center"
				        },
				        { 
				              "data": "maxQuotaNum",
				              "sTitle":"最高额度",
				              'sClass':"text-center"
				        },
				        { 
				              "data": "remaininguotaNum",
				              "sTitle":"可用额度",
				              'sClass':"text-center"
				        }
			         ],
					 fnServerParams: function (aoData) {  //查询条件
		             	aoData.push({ "name": "phoneNum", "value": $("#phoneNum").val() } );
		             	aoData.push({ "name": "state", "value": $("#state").val() } );
		             	aoData.push({ "name": "idCardNo", "value": $("#idCardNo").val() } );
		             },
		              aoColumnDefs : [
 						<shiro:hasPermission name="account:update or account:delete">
		             	{"aTargets" :8,"mRender" : function(data, type, row){
		             		var edit="",del="";
 		                    return edit+"&nbsp;"+del;
 		                	}
 		             	}
 		            	</shiro:hasPermission>
		             ] 
				});
				
				 $('#query').click(function(){
					$('#example').dataTable().fnDraw();
				});
			
			});
// 			//删除受影响的行数
			function deleteRow(id){
				console.log(id);
				$('#myModal').deleteRow('customer/del.htm?id='+id);
			}
			</script>
		<!---dialog选项-->
		<div>
			<jsp:include page="/WEB-INF/views/common/delete_dialog.jsp" />
			<jsp:include page="/WEB-INF/views/common/addupdate_dialog.jsp" />
			<div class="modal fade" id="insertAndUpdate" tabindex="-1"
				role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			</div>
		</div>
	</div>
</shiro:hasPermission>